<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>街道</title>
<link href="/css/base.css" type="text/css" rel="stylesheet" />
<link href="/css/manage.css" type="text/css" rel="stylesheet" />
<link href="/css/layout.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery.default.js"></script>
<script type="text/javascript" src="/js/jquery.validate.js"></script>
<script type="text/javascript" src="/js/xiaodian.js"></script>
<!--[if ie]><link href="/css/ie.css" type="text/css" rel="stylesheet"><![endif]-->
<style>
.face_box li {
margin: 0 8px 0 0;
}
</style>
<script type="text/javascript">
	
</script>

</head>

<body>
   <?php $this->load->view('head');?>
    <div class="w100p mb20">
    	<div class="w903 mg clearfix">
        	<div class="layout_left">
            	<!-- road -->
            	<div class="box_s5 mb12">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="road_box">
                        	<h1><?php echo $street['name']?> <span>(<?php echo $street['id']?>)</span></h1>
                            <div class="lr_box">
                                <div class="l_box">
                                    <a href="#"><img src="<?php echo $street['logo']?>" width="219" height="156" class="block" /></a>
                                </div>
                                <div class="r_box">
                                	<p>区域：<?php echo $area['value']?></p>
                                    <p class="mt20">居委会主任：
                                    <?php if($street['manager'] == null || $street['manager'] == ''):?>
                                    	<a href="javascript:;" class="apply">我要申请</a></p>
                                    <?php else:?>
                                    	<a href="<?php echo site_url('tamember?id='.$street['manager'])?>"  class="apply"><?php echo $street['mangname']?></a></p>
                                    <?php endif;?>
                                    
                                    <?php if(!$lived):?>
                                    	<a href="javascript:;" id="livehere"  class="def_btn_s11">我住在这里</a>
                                    <?php endif;?>
                                    
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class=" love_box">
                            	<div class="adder fr mr10">
                                	<a href="#" class="user"><?php echo $street['creator']?></a><span class="ml10"><?php echo date('Y-m-d',$street['createtime']);?></span>&nbsp;添加
                                </div>
                                <div class="love_nums">
                                	<i class="icon_heart"></i><a href="javascript:;" id="street_love"><span>喜欢<b><?php echo $street['loves']?></b></span></a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- road--end -->
                
                <!-- culture -->
                <div class="box_s5 mb12">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
							<h1><?php echo $street['name']?>的文化</h1>
                            <p class="culture_info">
                            <?php echo $street['history']?>
                            </p>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- culture--end-->
                
                <!-- installation -->
                <div class="box_s5 mb12">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
							<h1><?php echo $street['name']?>上有</h1>
                            <ul class="install">
                            	<li><a href="#" class="block"><i class="icon_mark_s1"></i></a></li>
                                <li><a href="#" class="block"><i class="icon_mark_s2"></i></a></li>
                                <li><a href="#" class="block"><i class="icon_mark_s3"></i></a></li>
                                <li><a href="#" class="block"><i class="icon_mark_s4"></i></a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- installation--end-->
                
                <!-- road_pic -->
                <div class="box_s5 mb12">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
							<h1 class="espe"><a href="#" class="more fr mr10">more</a><a href="#" class="def_btn_s12 mr10 fr">添加图片</a>恋街晒图<br class="clear" /></h1>
                            <ul class="road_pic">
                            	<?php foreach ($photoList as $key=>$photo):?>
                            		<li <?php if($key == 2):?>class="last"<?php endif;?>><a href="#" class="block"><img src="<?php echo site_url($photo['imagePath'])?>" width="172" height="124" class="block" /></a></li>
                            	<?php endforeach;?>
                            	
                            </ul>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- road_pic--end-->
                
                <!-- road_store-->
                <div class="box_s5 mb12">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
							<h1 class="espe"><a href="#" class="more fr mr10">more</a><?php echo $street['name']?>的小店<br class="clear" /></h1>
                            <ul class=" road_store">
                            	<?php foreach ($storeList as $store):?>
                            		<li>
	                                	<a href="<?php echo site_url('store?id='.$store['id'])?>" class="block"><img src="<?php echo site_url($store['photo'])?>" width="82" height="82" class="block" /></a>
	                                    <p class="store_name"><?php echo $store['name']?></p>
	                                </li>
                            	<?php endforeach;?>
                            	
                            </ul>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- road_store--end-->
                
                <!-- talk_subject -->
                <div class=" com_box_s1">
                	<h1><a href="#" class="more fr mr10">more</a>街道话题</h1>
                    <ul class="com_list lr_box talk_list">
                    	<?php foreach ($topicList as $topic):?>
                    	<li>
                            <div class="l_box"><i class="icon_arrow"></i></div>
                            <div class="r_box">
                                <p class="info">                                        	
                                    <a href="#"><?php echo $topic['title']?></a>
                                </p>
                                <div class="else_info mt10">
                                    <div class="data_nums">
                                    	<a target="_blank" href="<?php echo site_url('replylist/'.$topic['id'].'/5')?>" class="c_reply"><span>回复 </span>[<?php echo $topic['replys']?>]</a>
                                    </div>
                                    <div>来自：<a href="#" class="author"><?php echo $topic['creator']?></a><span class="ml10">最后回应：2012-08-02</span>  </div>
                                </div>
                            </div>
                            <div class="clear"></div>
                            <div class="com_comment" style="display:none;">

	                                <div class="main_comment">
	                                    <ul class="face_box">
	                                        <li express="[大笑]"><img src="../../images/others/face_1.png" /></li>
			                                <li express="[惊讶]"><img src="../../images/others/face_2.png" /></li>
			                                <li express="[害羞]"><img src="../../images/others/face_3.png" /></li>
			                                <li express="[哈切]"><img src="../../images/others/face_4.png" /></li>
			                                <li express="[白眼]"><img src="../../images/others/face_5.png" /></li>
			                                <li express="[大哭]"><img src="../../images/others/face_6.png" /></li>
			                                <li express="[偷笑]"><img src="../../images/others/face_7.png" /></li>
			                                <li express="[示爱]"><img src="../../images/others/face_8.png" /></li>
	                                    </ul>
	                                        <table class="com_form issue_comment">
	                                            <tbody>
		                                            <tr>
		                                                <td><textarea class=" def_ta_s5" name="info" style="width: 561px;"></textarea><br class="clear"><div class="validate_v" /></td>
		                                            </tr>
		                                            <tr>
		                                                <td class="tr"><input replyId="<?php echo $topic['id']?>" type="button" value="提交" class="def_btn_s9 mt5 submit reply_comment" /></td>
		                                            </tr>
	                                        	</tbody>
	                                        </table>
	                                </div>
	                            </div>
                        </li>
                        <?php endforeach;?>
                        
                    </ul>
                </div>
                <!-- talk_subject--end-->
                
                <!-- add_talk-->
                <div class=" com_box_s1">
                	<h1>写话题</h1>
                    <form action="" id="talk">
                        <table class="form_talk" width="100%">
                            <tr>
                                <td class="col1 vt" width="53"><span>标题</span></td>
                                <td>
                                    <div class="line"></div>
                                    <textarea class="title" name="title" id="topic_title"></textarea><br class="clear" />
                                    <div class="validate_v"></div>
                                </td>
                            </tr>
                            <tr>
                                <td class="col1 vt" width="53"><span>内容</span></td>
                                <td>
                                    <div class="line"></div>
                                    <textarea class="info" name="info" id="topic_info"></textarea><br class="clear" />
                                    <div class="validate_v"></div>
                                </td>
                            </tr>
                            <tr>
                                <td class="col1 vt" width="53"></td>
                                <td>
                                    <input type="submit" value="提交" class="def_btn_s13" />
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
                <!-- add_talk--end-->
                
            </div>
            
            <div class="layout_right">
            	
                <!-- notice -->
            	<div class="box_s6 mb15">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
                        	<h1>街道最新公告</h1>
                            <ul class="notice">
                            	<?php foreach ($announceList as $announce):?>
                            		<li>
	                                	<div class="clearfix">
	                                		<p class="title"><a href="#"><?php echo $announce['title']?></a></p>
	                                        <div class="clear"></div>
	                                    </div>
	                                </li>
                            	<?php endforeach;?>
                            	
                            </ul>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- notice--end-->
                
                <!-- impression -->
                <div class="box_s6 mb15">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
                        	<h1>给本街道留下的最深刻的印象</h1>
                            <div class="impression">
                            	<textarea id="tag_content"></textarea><input type="button" value="印象" id="tag_button" class="def_btn_s14"/>
                                <br class="clear" />
                            </div>
                            <div class="impression_tags">
                            	<a href="#" class="special">维多利亚</a><a href="#">复古</a><a href="#">饰品店</a><a href="#">nuicom</a>
                            </div>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- impression--end-->
                
                <!-- ruzhu -->
                <div class="box_s6 mb15">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
                        	<h1 class="espe"><a href="#" class="more fr mr10">more</a>刚刚入住</h1>
                            <ul class="rz_list">
                            	<?php foreach ($storeList as $store):?>
                            		<li>
	                                	<a href="<?php echo site_url('store?id='.$store['id'])?>" class="block"><img src="<?php echo $store['photo']?>" width="62" height="62" class="block" /></a>
	                                    <a href="<?php echo site_url('store?id='.$store['id'])?>" class="name"><?php echo $store['name']?></a>
	                                </li>
                            	<?php endforeach;?>
                            	
                               
                            </ul>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- ruzhu--end-->
                
                <!-- resident -->
                <div class="box_s6 mb15">
                	<div class="b_head"></div>
                    <div class="content">
                    	<div class="com_box">
                        	<h1><?php echo $street['name']?>的全部居民</h1>
                            <p class="resident"><?php echo $lives?>人住在这里</p>
                        </div>
                    </div>
                    <div class="b_foot"></div>
                </div>
                <!-- resident--end-->
                
                
            </div>
            
        </div>
    </div>
    
   <?php $this->load->view('foot')?>
</body>
<script type="text/javascript">
$(function(){
	
	$.validator.addMethod("stringCheck", function(value, element) {          
		return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);       	
	}, "只能包括中文字、英文字母、数字和下划线");  

	$("#talk").validate({
		submitHandler:function(form){
			var title = $("#topic_title").val();
			var info = $("#topic_info").val();
			var eId = '<?php echo $eID?>';
			$.post("<?php echo site_url('member/savetopic')?>",{
					title:title,
					info:info,
					eID:eId,
					type:1
				},function(data){
						var ret = $.parseJSON(data);
						alert(ret.msg);
						if(ret.success=='true'){
							$("#topic_title").val('');
							$("#topic_info").val('');
						}
						
					});
		} ,
		rules:{
			title:{
				required:true
			},
			info:{
				required:true
			}
			
		},
		messages:{
			title:{
				required:"话题标题不能为空！"
			},
			info:{
				required:"话题内容不能为空！"
			}
		},
		errorPlacement:function(error,element){
			error.appendTo(element.siblings("div.validate_v"));
		}
	});
	$("#tag_button").click(function(){
			var content = $("#tag_content").val();
			if(content == null || content == ''){
				alert('印象不能为空');
			}else{
				$.post('<?php echo site_url('member/savetag')?>',{
						name:content,
						eID:'<?php echo $eID?>',
						type:1
					},function(data){
						var ret = $.parseJSON(data);
						alert(ret.msg);
						if(ret.success=='true'){
							$("#tag_content").val('');
						}
					});
			}
		});
	$("#livehere").click(function(){
		$.post('<?php echo site_url('street/livehere')?>',{
				streetid:'<?php echo $eID?>'
			},function(data){
				var ret = $.parseJSON(data);
				alert(ret.msg);
				$("#livehere").remove();	
			});
	});


	//$.defaults.commentReply("<?php echo site_url('member/tologin')?>?gourl=<?php echo site_url('street?id='.$eID)?>");
	$(".reply_comment").click(function(){
		
		var content = $(this).parent().parent().parent().find("textarea[name='info']").val();
		if(content == null || content ==''){
			alert('评论不能为空');
			return ;
		}

		$.post("<?php echo site_url('member/replytopic')?>",{
			type:5,
			belongId:$(this).attr('replyId'),
			content:content
		},function(data){
				var ret = $.parseJSON(data);
				if(ret.success == 'true'){
					window.location.reload();
				}else{
					alert(ret.msg);
				}
				
			});
	});

	$("#street_love").click(function(){
		if(xiaodian.checkLogin()){
			$.post('<?php echo site_url('member/love')?>',{
					loveId:'<?php echo $street['id']?>',
					loveType:'1'
				},function(data){
					var ret = $.parseJSON(data);
					if(ret.success=='true'){
						var oldNum = $("#street_love").find("b").text();
						$("#street_love").find("b").text(parseInt(oldNum)+1);
					}else{
						alert(ret.msg);
					}
				})
			
		}else{
			window.location.href="<?php echo site_url('member/tologin')?>?gourl=<?php echo site_url('street?'.$street['id'])?>";
		}

	});
})
</script>
</html>
